package com.shanghaionstar.discover.adapter;

import android.content.Context;
import android.widget.TextView;

import com.onstar.cn.framework.annotation.FindViewById;
import com.onstar.cn.framework.base.CommonAdapter;
import com.onstar.cn.framework.base.CommonViewHolder;
import com.onstar.cn.mag.thirds.TrafficViolationsEntity;
import com.shanghaionstar.R;

import java.util.List;

/**
 * Created by 7828wc on 16/7/20.
 */
public class ViolationResultAdapter extends CommonAdapter<TrafficViolationsEntity> {

    public ViolationResultAdapter(List<TrafficViolationsEntity> datas, Context context) {
        super(datas, context);
    }

    @Override
    public void getView(int position, CommonViewHolder viewHolder) {
        ViewHolder holder = (ViewHolder) viewHolder;
        TrafficViolationsEntity violationsEntity = datas.get(position);

        holder.tv_agency.setText(violationsEntity.getAgency());
        holder.tv_time.setText(violationsEntity.getTime());
        holder.tv_address.setText(violationsEntity.getAddress());
        holder.tv_content.setText(violationsEntity.getContent());
        holder.tv_store.setText(violationsEntity.getScore() + "");
        holder.tv_money.setText(violationsEntity.getPrice() + "");
    }

    @Override
    public int layoutId() {
        return R.layout.discover_violation_result_item;
    }

    @Override
    public CommonViewHolder getViewHolder() {
        return new ViewHolder();
    }

    private class ViewHolder extends CommonViewHolder {
        @FindViewById
        TextView tv_agency, tv_time, tv_address, tv_content, tv_store, tv_money;
    }
}
